package com.atguigu.day15.test08;

/**
 * @author fenge
 */
public class Person {
    String name;
    double lifeValue;

    public Person() {
    }

    public Person(String name, double lifeValue) {
        this.name = name;
        setLifeValue(lifeValue);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getLifeValue() {
        return lifeValue;
    }

    public void setLifeValue(double lifeValue) {
//        this.lifeValue = lifeValue;
        if (lifeValue<0) {
            throw new NoLifeValueException("生命值不能为负数"+lifeValue);
        }
        this.lifeValue = lifeValue;
    }
}
